ConditionControl.inherit("Control");

function ConditionControl(node){
	this.Control(node);
	
	this.submitInvisible=this.properties.getObject("submitInvisible");
	this.dropDown=this.properties.getObject("dropDown");
	this.blinker=this.properties.getObject("blinker");
	this.invisibleValue=this.properties.getString("invisibleValue");
		
		
	this.dropDown.getEventHandler().registerListener("change", this);
	this.updateVisibility();
}

ConditionControl.prototype.getDropDown=function () {
	return this.dropDown;
}
	
ConditionControl.prototype.getBlinking=function () {
	return this.blinker;
}
	
ConditionControl.prototype.updateVisibility=function () {
	var value=this.dropDown.getValue();
	if (value==this.invisibleValue){
		this.blinker.setVisible(false);
	} else {
		this.blinker.setVisible(true);
	}
}
	
ConditionControl.prototype.toString=function () {
	//return this.dropDown.toString()+(this.blinker.getVisible()?(" "+this.blinker.toString()):"");
	return this.dropDown.toString()+((!this.submitInvisible)?(" "+this.blinker.toString()):"");
}

ConditionControl.prototype.onchange=function () {
	this.updateVisibility();
}
	
ConditionControl.prototype.clear=function () {
	this.dropDown.clear();
	this.updateVisibility();
}

